package com.taojiazheng.controller.myCreate;

import com.taojiazheng.common.ResultResponse;
import com.taojiazheng.service.myCreate.MyCreateService;
import com.taojiazheng.so.mycreate.MyCreateSo;
import com.taojiazheng.vo.myCreate.MyCreateVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author 赵成林
 * @date 2017/12/23 22:15
 */
@Controller
public class MyCreateController {
    @Autowired
    private MyCreateService myCreateService;
    @ResponseBody
    @RequestMapping(value = "mycreate/get")
    public ResultResponse getNyCreate(HttpServletRequest request){
        String token = request.getHeader("token");
        List<MyCreateVo> myCreateVoList = myCreateService.getMyCreates(token);
        return new ResultResponse(myCreateVoList);
    }

    @ResponseBody
    @RequestMapping(value = "mycreate/delete")
    public ResultResponse deleteMyCreate(HttpServletRequest request, @RequestBody MyCreateSo myCreateSo){
        myCreateService.deleteMyCreate(myCreateSo);
        return new ResultResponse();
    }
}
